<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <table border="1">
        <tr>
            <th>id</th>
            <th>标题</th>
            <th>价格</th>
            <th>销量</th>
            <th>操作</th>
        </tr>
        <tr v-for="p in arr">
            <td>{{p.id}}</td>
            <td>{{p.username}}</td>
            <td>{{p.password}}</td>
            <td>{{p.nick}}</td>
            <td>
                <a href="javascript:void(0)" @click="del(p.id)">删除</a>
<!--                <a :href="'/upd.html?id='+p.id"+>修改</a>-->
                <a :href="'/upd.html?id='+p.id">修改</a>
            </td>
        </tr>
    </table>
</div>
<script src="js/axios.min.js"></script>
<script src="js/vue.js"></script>
<script src="js/eui.js"></script>
<script>
    let v=new Vue({
        el:"div",
        data:{
                User:{id:"",username:"",password:"",nick:""},
                arr:[]
        },
        created:function(){
            axios.get("/list").then(function(response) {
                v.arr=response.data;
            })
        }
        ,
        methods:{
            del(id){
                axios.get("/delete?id="+id).then(function (response){
                    location.reload();
                    alert("用户已删除");
                })
            }
        }
    })
</script>
</body>
</html>